package edu.towson.cosc603.coffeemaker;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class InventoryTest extends TestCase {
    private Inventory inventory;
	private CoffeeMaker cm;
	private Recipe r1;
	private Recipe r2;
    
    @Before
    public void setUp() throws Exception {
    	inventory = new Inventory();
		cm = new CoffeeMaker();
		
		r1 = new Recipe();
		r1.setName("Recipe 1");
		r1.setPrice(1);
		r1.setAmtCoffee(1);
		r1.setAmtMilk(1);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(1);
		
		cm.addRecipe(r1);
		
		r2 = new Recipe();
		r2.setName("Recipe 2");
		r2.setPrice(100);
		r2.setAmtCoffee(100);
		r2.setAmtMilk(100);
		r2.setAmtSugar(100);
		r2.setAmtChocolate(100);
		
		cm.addRecipe(r2);
    }

    @After
    public void tearDown() throws Exception {
    	System.out.println(inventory);
    }
    
    // All valid inputs
    @Test
	public void testSetChocolate1() {
    	inventory.setChocolate(0);
    	assertEquals( 0, inventory.getChocolate() );
	}
    
    // Negative amount of chocolate
    @Test
	public void testSetChocolate2() {
    	inventory.setChocolate(-1);
    	assertEquals( 0, inventory.getChocolate() );
	}
    
    // All valid inputs
    @Test
	public void testSetCoffee1() {
    	inventory.setCoffee(0);
    	assertEquals( 0, inventory.getCoffee() );
	}
    
    // Negative amount of coffee
    @Test
	public void testSetCoffee2() {
    	inventory.setCoffee(-1);
    	assertEquals( 0, inventory.getCoffee() );
	}
    
    // All valid inputs
    @Test
	public void testSetMilk1() {
    	inventory.setMilk(0);
    	assertEquals( 0, inventory.getMilk() );
	}
    
    // Negative amount of milk
    @Test
	public void testSetMilk2() {
    	inventory.setMilk(-1);
    	assertEquals( 0, inventory.getMilk() );
	}
    
    // All valid inputs
    @Test
	public void testSetSugar1() {
    	inventory.setSugar(0);
    	assertEquals( 0, inventory.getSugar() );
	}
    
    // Negative amount of sugar
    @Test
	public void testSetSugar2() {
    	inventory.setSugar(-1);
    	assertEquals( 0, inventory.getSugar() );
	}
    
    // All valid inputs
    @Test
    public void testEnoughIngredients1() {
    	assertTrue(inventory.enoughIngredients(r1));
    }
    
    // Not enough ingredients
    @Test
    public void testEnoughIngredients2() {
    	assertFalse(inventory.enoughIngredients(r2));
    }
}
